package com.leap.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.leap.config.StringListTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@Builder
@TableName(value = "article",autoResultMap = true)
@Schema(description = "科普文章类")
public class Article {
    //雪花算法
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Schema(description = "文章标题")
    @TableField("title")
    private String title;

    @TableField("author_name")
    @Schema(description = "作者名字")
    private String authorName;

    @Schema(description = "文章html内容")
    @TableField(value = "html",typeHandler = StringListTypeHandler.class)
    private List<String> html;

    @Schema(description = "文章html内容")
    @TableField(value = "css",typeHandler = StringListTypeHandler.class)
    private List<String> css;

    @Schema(description = "文章分类id")
    @TableField("category_id")
    private Integer categoryId;

    @TableField("browse_num")
    @Schema(description = "浏览数")
    private Integer browseNum;

    @TableField("like_num")
    @Schema(description = "收藏数")
    private Integer likeNum;

    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "是否为视频类文章 0图片 1视频")
    @TableField("is_video")
    private int isVideo;

    @Schema(description = "是否已发布 0未发布 1已发布")
    @TableField("is_publish")
    private int isPublish;

}
